import request from "@/utils/request";

//获取轮播图
export function getBanner() {
    return request({
        url: "/api/lunbo/listall",
        method: "get",
    });
}

//获取首页数据 api/cate/listall
export function getIndexInfo(data) {
    return request({
        url: "/api/cate/listall",
        method: "get",
        params: data,
    });
}

// /api/goods/listall

export function listall(data) {
    return request({
        url: `/api/goods/listall`,
        method: "get",
        params: data
    });
}

//获取用户信息 api/user/info
export function getuserInfo() {
    return new Promise((resolve, reject) => {
        request({
            url: `/api/user/info`,
            method: "get",
        }).then(res => {
            resolve(res)
            uni.setStorageSync('role', res.data.remark)
        })
    })
}

//获取商品列表 api/goods/list/${this.pid}
export function getGoodsList(id, data) {
    return request({
        url: `/api/goods/list/${id}`,
        method: "get",
        params: data
    });
}

// 获取商品详情 api/goods/xq/${id}
export function getGoodsDetail(id) {
    return request({
        url: `/api/goods/xq/${id}`,
        method: "get",
    });
}

//公共内容列表 api/consult_text/list
export function getConsultList(data) {
    return request({
        url: `/api/consult_text/list`,
        method: "get",
        params: data
    });
}

// 公告信息 shop/notice/info/
export function getNoticeInfo(id) {
    return request({
        url: `/api/shop/notice/info${id}`,
        method: "get",
    });
}

// 微信查询下单商品信息 /api/goods/getGoodsInfo
export function getGoodsInfo(id) {
    return request({
        url: `/api/goods/getGoodsInfo`,
        method: "get",
        params: {id}
    });
}

//微信查询订单金额 /api/order/getMoney
export function getMoney(data) {
    return request({
        url: `/api/order/getMoney`,
        method: "get",
        params: data
    });
}
